package com.andyage.admin.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.andyage.admin.bean.AdWithdrawBean;
import com.andyage.admin.dao.AdWithdrawMapper;
import com.andyage.admin.service.IAdWithdrawService;
import com.andyage.util.JsonContent;

import net.sf.json.JSONObject;
@Service
public class AdWithdrawServiceImpl implements IAdWithdrawService {
	@Resource
	private AdWithdrawMapper adwithdrawMapper;
	
	@Override
	public String queryWithdrawInfo(AdWithdrawBean drawBean)throws Exception {
		List<AdWithdrawBean> list = adwithdrawMapper.queryWithdrawInfo(drawBean);
		int total = adwithdrawMapper.queryWithdrawInfoCount(drawBean);
		String json = JsonContent.getJsonArray(list, total);
		return json;
	}

	@Override
	public String updateWithdrawByecmStatus(AdWithdrawBean drawBean) throws Exception {
			int flag = adwithdrawMapper.updateWithdrawByecmStatus(drawBean);
			JSONObject json = new JSONObject();
			if(flag!=0){
				json.accumulate("result", 1);
				json.accumulate("tips", "提交成功");
			}else{
				json.accumulate("result", 0);
				json.accumulate("tips", "提交失败");
			}
		return json.toString();
	}
}
